﻿using DesktopToy.Core;
using DesktopToy.Core.Weather;
using DesktopToyWpf.ViewModels;

namespace DesktopToyWpf.Services;

public class MainService
{
    private readonly DeviceService DeviceService = new();
    
    public static LiveWeather? GetCurrentWeather()
    {
        try
        {
            return WebApi.GetLiveWeather(Global.Config.WebServiceApiKey, Global.Config.WeatherAdcode);
        }
        catch (Exception) // todo: 以后再弄一个全局的 Logger
        {
            return null;
        }
    }

    public void Start() => DeviceService.Start();

    public void Stop() => DeviceService.Stop();

    
    public float GetCpuTemperature() => DeviceService.GetCpuTemperature();
    public float GetGpuTemperature() => DeviceService.GetGpuTemperature();
    public float GetStorageTemperature() => DeviceService.GetStorageTemperature();

}